/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.igorov.efficientsoft.business.gestordistrito;

import com.igorov.efficientsoft.dataaccess.domain.DistritoDAO;
import com.igorov.efficientsoft.dataaccess.model.TdistritoVO;
import com.igorov.efficientsoft.services.DistritoDTO;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author igorov
 */
public class GestorDistritoImpl implements GestorDistrito{

    private DistritoDAO distritoDAO;

    public List<DistritoDTO> getAllByCiudad(int idCiudad) {
        List<TdistritoVO> tdistritoVOs = distritoDAO.getByCiudad(idCiudad);
        List<DistritoDTO> distritoDTOs = new LinkedList<DistritoDTO>();
        
        for (Iterator<TdistritoVO> it = tdistritoVOs.iterator(); it.hasNext();) {
            TdistritoVO tdistritoVO = it.next();
            DistritoDTO distritoDTO = new DistritoDTO(tdistritoVO.getNcodDis(),
                                                        tdistritoVO.getCnomDis(),
                                                        tdistritoVO.getTciudad().getNcodCiu());
            distritoDTOs.add(distritoDTO);
        }
        
        return distritoDTOs;
    }

    public DistritoDAO getDistritoDAO() {
        return distritoDAO;
    }

    public void setDistritoDAO(DistritoDAO distritoDAO) {
        this.distritoDAO = distritoDAO;
    }
    
    public void deleteById(int i) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void deleteByIndex(int index) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<DistritoDTO> getAll() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public DistritoDTO getById(int voId) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public DistritoDTO getByIndex(int indice) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getIdAtIndex(int indice) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getIndexOf(int voId) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void saveOrUpdate(DistritoDTO o) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void updateListVo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
